package com.aifund.app.service.impl;

import com.aifund.app.entity.form.sysCoinAccount.SystemCoinAccountVo;
import com.aifund.app.service.SystemCoinAccountService;
import com.aifund.common.dao.SystemCoinAccountDao;
import com.aifund.common.entity.SystemCoinAccount;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class SystemCoinAccountServiceImpl implements SystemCoinAccountService {

    @Autowired
    SystemCoinAccountDao systemCoinAccountDao;

    @Override
    public List<SystemCoinAccountVo> getAll() {
        List<SystemCoinAccount> all = systemCoinAccountDao.findAll();
        List<SystemCoinAccountVo> allVos = new ArrayList<>();
        for(SystemCoinAccount vo : all){
            SystemCoinAccountVo systemCoinAccountVo = new SystemCoinAccountVo();
            BeanUtils.copyProperties(vo,systemCoinAccountVo);
            allVos.add(systemCoinAccountVo);
        }
        return allVos;
    }
}
